﻿// ReSharper disable InconsistentNaming

using NUnit.Framework;
using ImageProcessing.Detectors;
using ImageProcessing.Common;

namespace ImageProcessing.Tests.Detectors
{
    [TestFixture]
    public class FastHessianTests
    {
        IInterestPointDetector FastHessian;

        [Test]
        public void GetInterestPoints_Square_Equal()
        {
            Assert.AreEqual(9, GetImagePoints("TestPics\\Square.jpg"));
        }

        [Test]
        public void GetInterestPoints_Usb_Equal()
        {
            Assert.AreEqual(761, GetImagePoints("TestPics\\usb1.jpg"));
        }

        [Test]
        public void GetInterestPoints_Card1_Equal()
        {
            Assert.AreEqual(2453, GetImagePoints("TestPics\\Card1Template.jpg"));
            Assert.AreEqual(979, GetImagePoints("TestPics\\Card1ZoomedIn.jpg"));
            Assert.AreEqual(1544, GetImagePoints("TestPics\\Card1ZoomedOut.jpg"));
        }

        [Test]
        public void GetInterestPoints_Card2_Equal()
        {
            Assert.AreEqual(1762, GetImagePoints("TestPics\\Card2Template.jpg"));
            Assert.AreEqual(3434, GetImagePoints("TestPics\\Card2ZoomedIn.jpg"));
            Assert.AreEqual(1538, GetImagePoints("TestPics\\Card2ZoomedOut.jpg"));
        }


        private int GetImagePoints(string imageName)
        {
            int height;
            int width;
            HelperMethods.GetImageDimensions(imageName, out width, out height);

            FastHessian = new FastHessian(0.0001f, 5, 2, width, height, new IntegralImage(width, height));

            return HelperMethods.GetPoints(imageName, FastHessian).Count;
        }
    }
}
